import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsNotEmpty } from 'class-validator';
import { PermissionEntity } from '../../permission/entities/permission.entity';

export class CreateRoleDto {
  @ApiProperty({
    type: String,
    description: '角色名',
    default: '管理员',
  })
  @IsNotEmpty({ message: '角色名不能为空' })
  readonly roleName: string;

  @ApiPropertyOptional({
    type: PermissionEntity,
    isArray: true,
    description: '拥有该权限的角色',
    default: new PermissionEntity(),
  })
  readonly permissions?: PermissionEntity[];

  public id?: string;
}
